package com.hyk.commonLib.common.utils.rx.activityResult;

import android.content.Intent;

import androidx.activity.result.ActivityResultCaller;

import com.hyk.commonLib.common.activity.BaseActivity;
import com.hyk.commonLib.common.fragment.BaseFragment;

import io.reactivex.rxjava3.core.Single;

public abstract class RxActivityResult<CONTAINER extends ActivityResultCaller> {
    protected CONTAINER container;

    protected RxActivityResult(CONTAINER container) {
        this.container = container;
    }

    public static RxActivityResult<?> get(BaseActivity<?> activity) {
        return new RxActivityResultInActivity(activity);
    }

    public static RxActivityResult<?> get(BaseFragment<?> fragment) {
        return new RxActivityResultInFragment(fragment);
    }

    public abstract Single<ActivityResultCompat> start(Intent intent);
}
